<template>
  <div class="module-box">
    <div class="announce-box">
      <div>
        <div class="item-head-box">
          <h3 class="item-head-title"
            ><img src="./img/announce_icon.044c536.png" alt="" />{{ type.title }}</h3
          >
          <div class="more-style">
            <span @click="getMoreNewList(type.type)">更多 &gt;</span>
          </div>
        </div>
        <ul class="announce-1">
          <li
            class="announce-1-item"
            v-for="item in list"
            :key="item.id"
            @click="getNewInfo(item.id,type.type)"
          >
            <div class="announce-img-box">
              <div class="month">{{ item.month }}</div>
              <div class="year">{{ item.year }}</div>
            </div>
            <div class="announce-name">{{ item.title }}</div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
import { useRouter } from 'vue-router'

/* 接收父组件传过来的值*/
const props = defineProps({
  list: Array,
  type: Object
})

const router = useRouter()

/* 获取更多的新闻列表 */
const getMoreNewList = async (type: number) => {
  // 跳转列表页
  router.push({ path: '/stunew/list', query: { type: type } })
}

/*获取政策新闻的详细信息*/
const getNewInfo = (id: number, type: number) => {
  // 跳转详情页
  router.push({ path: '/stunew/info', query: { id: id,type: type } })
}
</script>
<style scoped>
ol,
ul {
  list-style: none;
}
* {
  padding: 0px;
  margin: 0px;
}
.module-box .announce-box {
  background: fff;
  box-sizing: border-box;
  margin: 0 auto 16px;
  padding: 12px 40px;
  width: 1380px;
}
.item-head-box {
  display: flex;
  height: 30px;
  justify-content: space-between;
  margin-bottom: 8px;
  align-items: center;
}
.item-head-title {
  color: #1d2129;
  font-size: 22px;
  font-weight: 600;
}
.item-head-title img {
  height: 22px;
  margin-right: 10px;
  width: 22px;
}
.more-style {
  color: #86909c;
  cursor: pointer;
  font-size: 14px;
}
.announce-1 {
  width: 1300px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.announce-1-item {
  display: flex;
  width: 640px;
  height: 56px;
  padding: 6px 12px 6px 6px;
  margin-top: 16px;
  align-items: center;
  background: #fff;
  border-radius: 4px;
  box-sizing: border-box;
  cursor: pointer;
}

.announce-img-box {
  background: #e8f3ff;
  border-radius: 2px;
  box-sizing: border-box;
  flex-shrink: 0;
  height: 56px;
  margin-right: 10px;
  padding: 12px 12px 8px 0;
  width: 66px;
}
.announce-img-box .month {
  color: #1d2129;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}
.announce-img-box .year {
  color: #a9aeb8;
  font-size: 12px;
  line-height: 24px;
  text-align: right;
}
.announce-name {
  color: #1d2129;
  /* flex: 1; */
  font-size: 14px;
  line-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 450px;
  height: 22px;
  white-space: nowrap;
}
</style>
